/**
 * Created by John on 2016/7/26.
 */
var rsconf = {
    _id: 'rs0',
    members: [
        {_id: 1, host: 'localhost:27017'},
        {_id: 2, host: 'localhost:27018'},
        {_id: 3, host: 'localhost:27019'}
    ]
};

rs.initiate(rsconf);

rs.add("<secondary_host_name_or_dns><secondary_host_name_or_dns>:<port></port>");

rs.conf();

db.myDB.myCollection.ensureIndex({zip: 1, name: 1});

db.myDB.myCollection.ensureIndex({name: 'hash'});

sh.addSharrd("<replica_set_or_server_address></replica_set_or_server_address>");

sh.addSharrd("rs1/mgo1.test.net:27017");

sh.addSharrd("mgo1.test.net:27017");

sh.enableSharding('bigWords');